<?php $this->load->module('mobile/index/header', $common);?>
<div class="content">

    <form action="" class="listForm" method="post">
        <article class="bottom_c" id="payInfo">

            <section style="position: relative;">
                <span class="password fl" style="width:4em">用户名</span>
                    <span class="fRight fl">
                        <input name="name" placeholder="请输入用户名" type="text" value="<?php echo $name ;?>">
                    </span>
            </section>
   

            <section style="position: relative;">
                <span class="password fl" style="width:4em">姓名</span>
                    <span class="fRight fl">
                        <input name="realname" placeholder="请输入姓名" type="text" value="<?php if(!empty($info['realname'])) echo $info['realname'] ;?>">
                    </span>
            </section>


            <section style="position: relative;">
                <span class="password fl" style="width:4em">性别</span>
                    <span class="fRight fl">
                        <input type="radio" name="gender" value="1" checked="checked"/>男
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <input type="radio" name="gender" value="2" <?php if($info['gender']=='2'):?>checked="checked"<?php endif;?> />女
                    </span>
            </section>
            <section style="position: relative;">
                <span class="password fl" style="width:4em">手机</span>
                    <span class="fRight fl">
                        <input name="mobile" placeholder="请输入手机号" type="text" value="<?php if(!empty($info['mobile'])) echo $info['mobile'] ;?>"  />
                    </span>
            </section>

            <section style="position: relative;">
                <span class="password fl" style="width:4em">住址</span>
                    <span class="fRight fl">
                        <input name="address" placeholder="请输入住址" type="text" value="<?php if(!empty($info['address'])) echo $info['address'] ;?>"  />
                    </span>
            </section>


        </article>
        <div class="col_div">
            <a href="javascript:void(0);" class="btn btn-blue" title="修改">修改</a>
        </div>
    </form>
</div>

<?php $this->load->module('mobile/index/footer', $common);?>
<script type="text/javascript">
    function alert_popup(text){
        $.dialog({
            style:'tip',
            width:200,
            closeTime:500,
            content: '<p style="text-align: center">'+text+'</p>'
        }).open();
    }
$(function(){

    $('.btn').click(function(){
        if($('input[name="name"]').val().length == 0){
            alert_popup('请输入昵称');
            return false;
        }

        if($('input[name="realname"]').val().length == 0){
            alert_popup('请输入真实姓名');
            return false;
        }

        if($('input[name="mobile"]').val().length == 0){
            alert_popup('请输入手机号');
            return false;
        }else {
            var $val = $("input[name='mobile']").val();
            var length = $val.length;
            var status = (length == 11 && /^(((17[0-9]{1})|(13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/.test($val));
            if(status==false){
                alert_popup('请正确填写您的手机号码');
                return false;
            }
        }


        var name = $('input[name="name"]').val();
        var mobile = $('input[name="mobile"]').val();
        var address = $('input[name="address"]').val();
        var realname = $('input[name="realname"]').val();
        var gender = $('input[name="gender"]:checked').val();
        $.post('<?php echo $form_url ;?>',{
            name: name,
            realname: realname,
            mobile: mobile,
            address: address,
            gender: gender
        },function(data){
            if(data.status=='1')
            {
                window.location.reload() ;
            }
            alert_popup(data.info);
            return false;
        },'json')
    })

})
</script>